//
//  HBBondListCell.m
//  HuoBao
//
//  Created by chaiyanan on 15/12/3.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBBondListCell.h"

@interface HBBondListCell ()

@property (nonatomic, strong) NSArray *subAry;

@end

@implementation HBBondListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.backgroundColor = [LCCommon getColor:@"e1e1e1"];
        self.subAry = @[@"**君",@"4322.11",@"2015-12-1"];
        [self createCustomView];
    }
    return self;
}

- (void)createCustomView
{
    float x = 5;
    float av = (SCREEN_WIDTH-10)/3;
    
    for (int i=0;i<self.subAry.count;i++)
    {
        
        UIFont *font = [UIFont systemFontOfSize:12.0f];
        
        NSTextAlignment textAlignment = NSTextAlignmentCenter;
        
       
        CGRect frame = CGRectMake(x+i*av, 0, av, 44);
        
        LLog(@"detailCellframe:%@",NSStringFromCGRect(frame));
        
        UIColor *color = [LCCommon getColor:@"888888"];
        
        UILabel *lable = [self createLableWithTextColor:color font:font text:self.subAry[i] textAlignment:textAlignment frame:frame superView:self.contentView];
        if (i==0)
        {
            self.nameLable = lable;
        }
        else if (i==1)
        {
            self.moneyLable = lable;
        }
        else
        {
            self.timeLable = lable;
        }
    }
    
//    UIImage *image = [UIImage imageNamed:@"bond_rightArrow"];
//    UIImageView *goIV = [[UIImageView alloc]initWithImage:image];
//    goIV.frame = CGRectMake(SCREEN_WIDTH-15-image.size.width, (44-image.size.height)/2, image.size.width, image.size.height);
//    [self.contentView addSubview:goIV];
    
    [self createSepratorLineWithFrame:CGRectMake(15, 44-1/([UIScreen mainScreen].scale), SCREEN_WIDTH-30, 1/([UIScreen mainScreen].scale)) backgroundColor:[LCCommon getColor:@"cccccc"] superView:self.contentView];
}

- (UILabel *)createLableWithTextColor:(UIColor *)color font:(UIFont *)font text:(NSString *)text textAlignment:(NSTextAlignment)textAlignment frame:(CGRect)frame superView:(UIView *)superView
{
    UILabel *lable = [[UILabel alloc]initWithFrame:frame];
    lable.textColor = color;
    lable.font = font;
    lable.text = text;
    lable.textAlignment = textAlignment;
    [superView addSubview:lable];
    return lable;
}

- (UIView *)createSepratorLineWithFrame:(CGRect)frame backgroundColor:(UIColor *)bgColor superView:(UIView *)superView
{
    UIView *sepratorLine = [[UIView alloc]initWithFrame:frame];
    sepratorLine.backgroundColor = bgColor;
    [superView addSubview:sepratorLine];
    return sepratorLine;
}


@end
